﻿<UserControl x:Class="PicturePortfolio.Silverlight.Views.ThumbnailView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:ca="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro"
    xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit" 
    xmlns:thumb="clr-namespace:PicturePortfolio.Silverlight"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400" Width="Auto">
    
    <Grid x:Name="LayoutRoot" Background="Transparent" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ShowGridLines="False">
        <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Width="Auto" BorderThickness="0">


            <ListBox x:Name="ThumbNails" ScrollViewer.HorizontalScrollBarVisibility="Disabled" BorderThickness="0" Background="Transparent">
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="SelectionChanged">
                        <ca:ActionMessage MethodName="ImageSelectionChanged">
                            <ca:Parameter Value="{Binding ElementName=ThumbNails,Path=SelectedItem}"></ca:Parameter>
                        </ca:ActionMessage>
                    </i:EventTrigger>
                </i:Interaction.Triggers>
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <toolkit:WrapPanel HorizontalAlignment="Stretch"  Orientation="Horizontal" Background="Transparent"/>
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Border BorderBrush="Transparent" 
							    BorderThickness="1" 
							    CornerRadius="0" 
							    Background="Black" Margin="5">
                            <ContentControl ca:View.Model="{Binding}" Margin="5"/>
                        </Border>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </ScrollViewer>        
    </Grid>
</UserControl>
